翻訳と辞書
Words near each other
・ Dekho Bhopal
・ Dekho Magar Pyaar Se
・ Dekho.com.pk
・ DeKi 300
・ Dekijima Station
・ Dekiling Gewog
・ Dekina
・ Dekinai
・ Dekinda
・ Dekirukana
・ Dekitate High School
・ Dekkas Formation
・ Dekker
・ Dekker Curry
・ Dekker Dreyer
Dekker's algorithm
・ Dekkers
・ Dekkersduin
・ Dekkersduin (painting)
・ Dekkhinathiri Township
・ Dekko
・ Deklan Wynne
・ Deklanlu
・ Deklidash
・ Dekmanca
・ Deknni
・ Deko Boko Friends
・ Dekoa
・ Dekochari
・ Dekoda Watson


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Dekker's algorithm : ウィキペディア英語版
Dekker's algorithm
Dekker's algorithm is the first known correct solution to the mutual exclusion problem in concurrent programming. The solution is attributed to Dutch mathematician Th. J. Dekker by Edsger W. Dijkstra in an unpublished paper on sequential process descriptions〔 (undated, 1962 or 1963); English translation (About the sequentiality of process descriptions )〕 and his manuscript on cooperating sequential processes.〔 (September 1965)〕 It allows two threads to share a single-use resource without conflict, using only shared memory for communication.
It avoids the strict alternation of a naïve turn-taking algorithm, and was one of the first mutual exclusion algorithms to be invented.
==Overview==

If two processes attempt to enter a critical section at the same time, the algorithm will allow only one process in, based on whose turn it is. If one process is already in the critical section, the other process will busy wait for the first process to exit. This is done by the use of two flags, ] and , which indicate an intention to enter the critical section on the part of processes 0 and 1, respectively, and a variable that indicates who has priority between the two processes.
Dekker's algorithm can be expressed in pseudocode, as follows.

}
// critical section
...
turn ← 1
wants_to_enter() ← false
// remainder section

|align="left" |

p1:
wants_to_enter() ← true
while wants_to_enter()
}

// critical section
...
turn ← 0
wants_to_enter() ← false
// remainder section

|}

Processes indicate an intention to enter the critical section which is tested by the outer while loop. If the other process has not flagged intent, the critical section can be entered safely irrespective of the current turn. Mutual exclusion will still be guaranteed as neither process can become critical before setting their flag (implying at least one process will enter the while loop). This also guarantees progress as waiting will not occur on a process which has withdrawn intent to become critical. Alternatively, if the other process's variable was set the while loop is entered and the turn variable will establish who is permitted to become critical. Processes without priority will withdraw their intention to enter the critical section until they are given priority again (the inner while loop). Processes with priority will break from the while loop and enter their critical section.
Dekker's algorithm guarantees mutual exclusion, freedom from deadlock, and freedom from starvation. Let us see why the last property holds. Suppose p0 is stuck inside the "while wants_to_enter()" loop forever. There is freedom from deadlock, so eventually p1 will proceed to its critical section and set turn = 0 (and the value of turn will remain unchanged as long as p0 doesn't progress). Eventually p0 will break out of the inner "while turn ≠ 0" loop (if it was ever stuck on it). After that it will set wants_to_enter() to true and settle down to waiting for wants_to_enter() to become false (since turn = 0, it will never do the actions in the while loop). The next time p1 tries to enter its critical section, it will be forced to execute the actions in its "while wants_to_enter()" loop. In particular, it will eventually set wants_to_enter() to false and get stuck in the "while turn ≠ 1" loop (since turn remains 0). The next time control passes to p0, it will exit the "while wants_to_enter()" loop and enter its critical section.
If the algorithm were modified by performing the actions in the "while wants_to_enter()" loop without checking if turn = 0, then there is a possibility of starvation. Thus all the steps in the algorithm are necessary.

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Dekker's algorithm」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.